﻿<%@ Page Title="Danh sách menu hệ thống" Language="C#" MasterPageFile="~/App_MasterPages/Aquarius.Master" AutoEventWireup="true" CodeBehind="SysMenuPage.aspx.cs" Inherits="Anuntiomatic.Server.SysMenuPage" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            RegisterDialog();
        });
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
    <div class="head">
        <!-- Tiêu đề của bảng (Thẻ div này chứa nút Addnew và refresh) -->
        <div class="isw-grid"></div>
        <h1>Menu</h1>
        <ul class="buttons">
            <li>
                <asp:LinkButton CssClass="isw-plus" ID="lbtnAddNew" runat="server" OnClick="lbtnAddNew_Click"></asp:LinkButton>
            </li>
        </ul>
        <div class="clear"></div>
    </div>
    <div class="block-fluid table-sorting">
        <asp:GridView ID="grvSysMenu" CssClass="dataTables_wrapper table2 dataTable" runat="server"
            AutoGenerateColumns="false" OnRowCommand="grvSysMenu_RowCommand">
            <Columns>
                <asp:TemplateField HeaderText="Tên" ItemStyle-CssClass="Text">
                    <ItemTemplate>
                        <%# SysMenu.GetNameByLevel(Eval("MenuName").ToString(), Eval("Level").ToString())%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="Liên kết" DataField="Link" ItemStyle-CssClass="Text" />
                <%--<asp:BoundField HeaderText="Kiểu liên kết" DataField="Target" ItemStyle-CssClass="Text" />
                <asp:BoundField HeaderText="Hình ảnh" DataField="Image" ItemStyle-CssClass="Text" />
                <asp:BoundField HeaderText="Diễn giải" DataField="Description" ItemStyle-CssClass="Text" />--%>
                <asp:BoundField HeaderText="STT" DataField="Ord" ItemStyle-CssClass="STT" />
                <asp:TemplateField HeaderText="Chức năng" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:LinkButton ID="lbtnAddChild" Text="Thêm" runat="server"
                            CommandName="AddChild" CommandArgument='<%#Eval("MenuID")%>' />
                            &nbsp;|&nbsp;
                        <asp:LinkButton ID="lbtnEdit" Text="Sửa" runat="server"
                            CommandName="Editing" CommandArgument='<%#Eval("MenuID")%>' />
                            &nbsp;|&nbsp;
                        <asp:LinkButton ID="lbtnDelete" Text="Xóa" runat="server"
                            CommandName="Deleting" CommandArgument='<%#Eval("MenuID")%>' OnClientClick="return confirm('Bạn có chắc chắn muốn xóa không?');"/>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>

    <!-- Khai báo dialog Edit -->
    <asp:Panel ID="dialogPanel" runat="server">
        <div class="dialog" id="dialog-form" style="display: none; width: 600px; height: 600px;" title="Menu">
            <asp:HiddenField ID="hdfObjectId" runat="server" />
            <div class="block">
                <table width="100%">
                    <tr>
                        <td>Tên &nbsp;</td>
                        <td>
                            <asp:TextBox ID="txtMenuName" runat="server"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td>Menu cha &nbsp;</td>
                        <td>
                            <asp:DropDownList ID="ddlParentID" runat="server"></asp:DropDownList></td>
                    </tr>
                    <tr>
                        <td>Liên kết &nbsp;</td>
                        <td>
                            <asp:TextBox ID="txtLink" runat="server"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td>Diễn giải &nbsp;</td>
                        <td>
                            <asp:TextBox ID="txtDescription" runat="server"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td>STT &nbsp;</td>
                        <td>
                            <asp:TextBox ID="txtOrd" runat="server" onkeypress="return ValidateKeypress(/\d/, event)"></asp:TextBox></td>
                    </tr>
             </table>
                <div class="dr"><span></span></div>
                <div style="text-align: right">
                    <asp:Button ID="btnSave" CssClass="btn" runat="server" Text="Lưu" OnClick="btnSave_Click" />
                    <input type="button" class="btn" value="Đóng" onclick="$('#dialog-form').dialog('close'); return false;" />
                </div>
            </div>
        </div>
    </asp:Panel>
</asp:Content>
